package com.zzyl.nursing.controller.member;

import cn.hutool.extra.tokenizer.Result;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.domain.PageResult;
import com.zzyl.nursing.domain.WxProjectQueryParam;
import com.zzyl.nursing.service.INursingProjectService;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.zzyl.common.utils.PageUtils.startPage;

@RestController
@RequestMapping("/member/orders/project")
public class MemberOrdersProjectController extends BaseController {

    @Autowired
    private INursingProjectService nursingProjectService;

    @GetMapping("/page")
    public AjaxResult PageProject( WxProjectQueryParam param){
        PageResult<NursingProject> pageResult = nursingProjectService.PageProject(param);
        AjaxResult success = AjaxResult.success("查询成功");
        success.put("total",pageResult.getTotal());
        success.put("rows",pageResult.getRows());
        return success;
    }
//    public TableDataInfo<List<NursingProject>> list(@ApiParam("护理项目查询条件") NursingProject nursingProject)
//    {
//        startPage();
//        List<NursingProject> list = nursingProjectService.selectNursingProjectList(nursingProject);
//        return getDataTable(list);
//    }


    @GetMapping("{id}")
    public R<NursingProject> getProjectById1(@PathVariable Integer id){
        return R.ok(nursingProjectService.selectNursingProjectById(Long.valueOf(id)));
    }
}
